package com.billdowney.entity.file;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.billdowney.entity.base.BaseEntityIdByUUIDHex;
import com.billdowney.entity.user.UserInfo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * 文件信息表
 * 
 * @author 超级小富翁 - BillDowney
 * @data 2017年10月23日 下午4:59:38
 */
@Entity
@Table(name = "file_info")
@ApiModel(description = "文件信息")
public class FileInfo extends BaseEntityIdByUUIDHex {

	private static final long serialVersionUID = 1536587875904788083L;
	@ApiModelProperty(value = "字段名", notes = "文件上传时的字段名")
	@Column(length = 20)
	private String fieldName;
	@ApiModelProperty(value = "原文件名", notes = "上传时的文件名")
	@Column(length = 200)
	private String fileName;
	@ApiModelProperty(value = "保存的文件名", notes = "保存到服务器时的文件名")
	@Column(length = 250)
	private String saveFileName;
	@ApiModelProperty(value = "文件大小(B)", notes = "文件大小，单位：字节(B)，1KB=1024B")
	private long fileSize;
	@ApiModelProperty(value = "文件类型")
	@Column(length = 60)
	private String fileType;
	@ApiModelProperty(value = "访问次数", notes = "通过接口访问成功的次数")
	private int visitNum;
	@ApiModelProperty(value = "下载成功次数")
	private int downloadNum;
	@ApiModelProperty(value = "服务器本地路径", notes = "存在服务器的哪个位置，不包括文件名")
	@Column(length = 400)
	private String localPath;
	@ApiModelProperty(value = "服务器本地文件路径", notes = "存在服务器的哪个位置，包括文件名")
	@Column(length = 650)
	private String localFilePath;
	@ApiModelProperty(value = "文件名后缀")
	@Column(length = 20)
	private String fileSuffix;
	@ApiModelProperty(value = "是否公用", notes = "1：可以公用；0：不能公用")
	@Column(length = 1)
	private int isPublic;

	@ManyToOne(targetEntity = UserInfo.class, cascade = { CascadeType.MERGE,
			CascadeType.REFRESH }, fetch = FetchType.LAZY)
	@JoinColumn(name = "userInfo_id")
	@ApiModelProperty(value = "用户信息")
	private UserInfo userInfo;

	public String getFieldName() {
		return fieldName;
	}

	public void setFieldName(String fieldName) {
		this.fieldName = fieldName;
	}

	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	public String getSaveFileName() {
		return saveFileName;
	}

	public void setSaveFileName(String saveFileName) {
		this.saveFileName = saveFileName;
	}

	public long getFileSize() {
		return fileSize;
	}

	public void setFileSize(long fileSize) {
		this.fileSize = fileSize;
	}

	public String getFileType() {
		return fileType;
	}

	public void setFileType(String fileType) {
		this.fileType = fileType;
	}

	public int getVisitNum() {
		return visitNum;
	}

	public void setVisitNum(int visitNum) {
		this.visitNum = visitNum;
	}

	public int getDownloadNum() {
		return downloadNum;
	}

	public void setDownloadNum(int downloadNum) {
		this.downloadNum = downloadNum;
	}

	public String getLocalPath() {
		return localPath;
	}

	public void setLocalPath(String localPath) {
		this.localPath = localPath;
	}

	public String getLocalFilePath() {
		return localFilePath;
	}

	public void setLocalFilePath(String localFilePath) {
		this.localFilePath = localFilePath;
	}

	public String getFileSuffix() {
		return fileSuffix;
	}

	public void setFileSuffix(String fileSuffix) {
		this.fileSuffix = fileSuffix;
	}

	public int getIsPublic() {
		return isPublic;
	}

	public void setIsPublic(int isPublic) {
		this.isPublic = isPublic;
	}

	public UserInfo getUserInfo() {
		return userInfo;
	}

	public void setUserInfo(UserInfo userInfo) {
		this.userInfo = userInfo;
	}

}
